package com.mail.pojo;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Accessors(chain=true)
@TableName("email_config")
public class EmailConfig implements Serializable {
    private static final long serialVersionUID = 1L;

    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    private Long userId;

    private String accountEmail;

    private Integer emailType;

    private String emailKey;

    private String emailPort;

    private String sendHost;

    //创建时间
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;


    //更新时间
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


    //创建人
    @TableField(fill = FieldFill.INSERT)
    private Long createUser;


    //修改人
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateUser;

    public EmailConfig(Long id, Long userId, String accountEmail, Integer emailType, String emailKey) {
        this.id = id;
        this.userId = userId;
        this.accountEmail = accountEmail;
        this.emailType = emailType;
        this.emailKey = emailKey;
    }

    public EmailConfig(Long userId, String accountEmail, Integer emailType, String emailKey) {
        this.userId = userId;
        this.accountEmail = accountEmail;
        this.emailType = emailType;
        this.emailKey = emailKey;
    }

    public EmailConfig(String emailKey, String emailPort, String sendHost) {
        this.emailKey = emailKey;
        this.emailPort = emailPort;
        this.sendHost = sendHost;
    }

    public EmailConfig(Long userId, String accountEmail, Integer emailType, String emailKey, String emailPort, String sendHost) {
        this.userId = userId;
        this.accountEmail = accountEmail;
        this.emailType = emailType;
        this.emailKey = emailKey;
        this.emailPort = emailPort;
        this.sendHost = sendHost;
    }
}
